home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Almathera Ten Pack 2: CDPD 1
/
Almathera Ten on Ten - Disc 2: CDPD 1.iso
/
pd
/
351-375
/
370
/
sksh
/
addendum1.5.doc
< prev
next >
Wrap
Text File
|
1995-03-14
|
32KB
|
859 lines
Addendum for Version 1.5
SKsh
A ksh-like Shell for the Amiga
Version 1.5
(Copyright) 1989, 1990
Steve Koren
July 21, 1990
Addendum to Version 1.5
This document describes additions and changes to SKsh since
version 1.4.
User Definable Keymaps
SKsh 1.5 permits the keyboard mapping to be changed
arbitrarily. Any single or multiple key sequence can be
mapped to any on of 35 functions, and macros can be created
which combine other functions. Either modeless editors
(such as emacs) or multi-mode editors (such as vi) can be
simulated.
To support this, the "setmap" command has been added. It
has the following forms:
Reset all keymaps to their original (dumb) state:
setmap -r
Set any number of keys in keymap "map" to call functions,
other keymaps, or macros:
setmap -s map [{key|code} {fn|"@map"|"!macro"}] ...
Set keymaps "m1", "m2", etc to exit to keymap "m0" after
one key:
setmap -e m0 [ m1 ]...
Set keymaps "m1", "m2", etc to be non-exiting keymaps
(ie, SKsh keeps using those keymaps even after they have
executed a function).
setmap -n [ m1 ]...
Define macro "mac" to call functions or insert strings:
setmap -m mac [ fn | string ] ...
Keymap functions have short names such as "INS", which in-
serts the character just typed, or "EOL" which moves the
cursor to the end of the current line. Key mapping, along
with the associated functions, is described in much more
detail in the UserMan.doc and Reference.doc files. Please
see those files for more information.
SKsh Amiga Shell Page 2 Addendum to 1.5
Supplied functions define "emacs" mode and "vi" mode
By default, the ".skshinit" file sets SKsh to be in "emacs"
mode, a slight superset of the previous SKsh editing mode.
However, this can be changed; two functions in the
stuff.sksh file define an emacs mode and a vi mode. Other,
similar functions could be added to define most other edi-
tor styles.
"E" option to SKsh obsoleted
The "E" option to SKsh has been obsoleted by the addition
of user definable keymaps. The "E" option previously con-
trolled whether the "tab" key was used for file name
completion or as an actual "tab" character. In SKsh 1.5,
you may simply change the definition of the "tab" key
accordingly.
ARexx support added
SKsh can now accept commands from an ARexx script. It does
this asynchronously; no special command must be entered.
However, it will only check for ARexx commands when it is
not busy doing something else (ie, it is waiting for key-
board input). SKsh assumes a default port name, but there
are several ways to specify this upon invocation (for de-
tails, see the "sksh" entry in the reference manual and the
ARexx section of the UserMan.doc manual). There is also a
new variable called "AREXX_PORT" which contains the name of
the port that this execution of SKsh uses. The variable
will be unset if SKsh was not able or was instructed not to
open ARexx. The "rx" command can be used to invoke ARexx
scripts. For more information, see the "Using SKsh with
ARexx" section of the UserMan.doc file.
The ARexx port is only provided in the large version of
SKsh, not tiny_sksh. There are a few problems with it and
a significant number of possible enhancements (for example,
the ability to set ARexx variables from SKsh). If you have
any ideas for improvements to the ARexx port, please let me
know. I will almost for certain enhance the ARexx func-
tionality in a future release.
Local export command added
A new "-l" option to the export command can be used to con-
trol whether SKsh sets AmigaDos environment variables for
exported variables, or simply sets the top level symbol
table definition inside of SKsh. Most variables will not
need to be exported to AmigaDos; the "-l" export option
will use less space and make the export operation faster.
SKsh Amiga Shell Page 3 Addendum to 1.5
Append redirection from external binaries fixed
An incompatibility between the Lattice and AmigaDos I/O
functions previously prevented append redirection from
working correctly when used with external programs. The
part of SKsh which controls this was rewritten to use the
AmigaDos functions instead of the (more standard) Lattice
functions; append redirection from external binaries now
works correctly. (Note that is was not a problem with ei-
ther the AmigaDos or Lattice functions, but simply a prob-
lem in the interface between the two).
All function keys now available
In SKsh 1.4, the "f10" key was not mappable. In SKsh 1.5,
it is. Also in this version, the shifted function keys may
be used by setting variables "f11" through "f20".
Cursor moved to end of line upon return
A small incompatibility between the AmigaDos console han-
dler and the popular "Conman" handler was causing a problem
if "return" was pressed while the cursor was in the middle
of a line. The rest of the line would be blanked (although
it executed correctly). SKsh now provides a workaround to
that problem by moving the cursor to the end of the line
after a "return".
There is still two problems when using SKsh with conman.
First, the conman typeahead buffer appears to be emptied
when SKsh puts the console in "raw" mode (as it must).
However, since this seems to be something conman is doing
by itself, I don't think I can change it from SKsh. Sec-
ond, the state of conman is sometimes changed such that
conman echoes characters even while in raw mode. I also
cannot fix this, as I do not know what causes it. For this
reason it is recommended that the normal AmigaDos console
handler be used with SKsh, especially since SKsh line edit-
ing is a superset of conman line editing. The AmigaDos
console handler exhibits neither of these symptoms.
Fixed "history" bug introduced in SKsh 1.4
A bug that was introduced in SKsh 1.4 caused "history -e"
not to act correctly. It is now fixed. Sorry! This also
affected '!' history access, as '!' was simply an alias for
history -e.
SKsh Amiga Shell Page 4 Addendum to 1.5
"eval" builtin added
The "eval" command executes a string as if it was a command
typed from the keyboard or entered into a script. For ex-
ample,
[dh0:]: a='echo "foo\nbar" | wc'
[dh0:]: eval "$a"
Filename Chars Words Lines
stdin : 8 2 2
[dh0:]:
"pushd" and "popd" now check for existance of directory
The "pushd" and "popd" functions which were provided in the
Stuff.sksh file for 1.4 did not check for the existance of
the directory before trying to "cd" to it. This never
caused any major problems, but it would cause the directory
stack variable to become out of sync with reality if a
"pushd" tried to "cd" to a nonexistent directory. Both
functions now check for the existence of the directory.
Lattice "chdir()" call no longer used
SKsh previously used the Lattice "chdir()" call to change
the current directory. However, the Lattice call did not
correctly update the AmigaDos structure containing the cur-
rent directory name, which caused "ps" to report the wrong
directory name for background tasks. The Lattice call is
no longer used, and "ps" reports the correct directory from
which the other tasks were executed.
SKsh no longer gets confused upon external "cd"
SKsh 1.4 became confused and even occasionally crashed if
an external program changed the SKsh working directory.
While this is not a common case, SKsh 1.5 has fixed this
problem. If an external program changes the SKsh direc-
tory, when control returns to SKsh it will correctly update
its directory (in all places, including the prompt if it is
defined there). However, in this case the "OLDPWD" vari-
able will not correctly contain the name of the previous
directory.
"Stack" function removed
All previous versions of SKsh included a "stack" function
defined in the .skshinit file which simply used the
AmigaDos stack function to set the stack size to the sup-
plied value plus 10K bytes. Since this function didn't do
SKsh Amiga Shell Page 5 Addendum to 1.5
much, and it took space for every SKsh invocation, it has
been removed. Use the AmigaDos stack function in the same
way; just be careful not to set the stack size below that
required by SKsh.
Backslash handling enhanced
A backslash outside of any other parameter but at the end
of a line tells SKsh to read the next line as if it was a
continuation of the current one. This can be useful to
pass many parameters to functions or scripts when all the
parameters would not normally fit on one line. The new
"Stuff.sksh" file uses this feature in the vi_mode and
emacs_mode functions.
Backquote bug fixed
An obscure bug in backquote substitution has been fixed.
If multiple complete SKsh shell constructs were inclosed in
backquotes and separated by newlines instead of semicolons,
only the first one would be evaluated. This problem never
appeared with the $( ) style of command substitution (which
is the recommended method), so it was not commonly a
problem.
Expert commands smaller
The expert commands have been further reduced in size from
their 1.4 counterparts. Most are smaller by approximately
500 to 1000 bytes (10 to 30%).
fgrep/grep changes
A bug in the fgrep/grep commands was causing them to ignore
patterns which spanned 16K byte boundaries in a file. This
has been fixed. In addition, the commands no longer print
2 newlines between file names when no pattern was found in
the file. Also, they no longer cycle though all the files
if the ctrl-c is pressed; instead, they exit immediately.
cp bug fixed
The 1.4 cp command would not copy multiple files to a di-
rectory if those files already existed in the directory.
This has been fixed.
SKsh Amiga Shell Page 6 Addendum to 1.5
view enhancements
The "vmagic:" assignment now points to a directory which
contains the magic file, not the file itself. Note that if
you define this assignment in a startup file, you will have
to change it. "view" now finds the magic file by taking
the filename of "view" and adding the ".magic" extension.
This means that view can be copied to another name, and
that copy can automatically use a different magic file.
For example, if "view" is copied to "vlist", the magic file
name will become "vmagic:vlist.magic". This can be useful
to create versions of view which edit, extract, list, or
otherwise manipulate files. It will become even more use-
ful when AmigaDos supports file links. Also, view now ac-
cepts a command line option which allows an arbitrary magic
file to be specified, overriding the built in defaults.
See the documentation on the "view" command for details.
"preparse" command added
A "preparse" command has been added which can parse an SKsh
script file and save the parsed output to another file.
The second file (which is often smaller than the original)
can be read by SKsh up to 3 times as fast as the original.
Please note that preparsed files are not guaranteed to be
upwardly compatible between versions of SKsh. This means
that the originals must be kept (in any case, the preparsed
files are extremely difficult to edit). SKsh will check
that a prepared file was created by the current versions of
SKsh, and issue an error if it was not. See the descrip-
tion of this command in the Reference.doc file for more
details.
You can automatically source the preparse form of a script
if it is there, or the normal one if it is not, by using
the following code fragment:
if [ -f myscript.pp ]
then
. myscript.pp
else
. myscript
fi
Preparsed versions of the init files now handled
SKsh will now check for ".skshinit.pp" and ".skshrc.pp"
files which are preparsed forms of the initialization
files, and use those instead if found. If not, the origi-
nals will be used. This can dramatically reduce the time
necessary to invoke SKsh. Also, if you source all or part
SKsh Amiga Shell Page 7 Addendum to 1.5
of the "Stuff.sksh" file from your .skshrc file, you can
now source a preparsed form of that file. Both sourcing
and script execution automatically detect preparsed files
and use them accordingly. You can change your .skshrc file
to do the same thing. For example:
if [ -f sksh:stuff.sksh.pp ]
then
. sksh:Stuff.sksh.pp
else
. sksh:Stuff.sksh
fi
File completion enhanced
SKsh file name completion has been enhanced. If completion
is used and matches a directory name, a "/" will be in-
serted automatically after the name. If completion wholely
matches a filename, a space will be inserted. This makes
it easy to tell when a whole file or directory name has
been matched, and which it was.
Also, file names which are typed directly after a redirec-
tion symbol (such as ">myfile") will be correctly handled
by the completion mechanism. Previously this did not work.
"printf" builtin added
A "printf" builtin has been added. It supports most of the
constructs used by the "c" function of the same name. How-
ever, there are a few limitations. SKsh uses 32 bit inte-
gers internally; therefore, "%ld" must be used instead of
"%d". Also, since all tokens are represented in SKsh as
strings, SKsh will assume that a string beginning with "-"
or a digit is to be used with the "%ld" style of arguments
and convert the string to a 32 bit integer. Arguments to
printf are separated by white space, not "," as in "c".
There is no associated sprintf or fprintf functions. Sim-
ply use "var=$(printf)" or "printf >> file" instead. See
the description of this command in the Reference.doc file
for more details.
All external binaries now pure
All of the external SKsh binaries are now pure, and all can
be made resident with the SKsh resident command. If the
pure bit is not set on all the binaries, you should set it
using the chmod command.
SKsh Amiga Shell Page 8 Addendum to 1.5
Documentation changes
I had accidentally left the entry for the "resident" buil-
tin out of the Reference.doc file for version 1.4. It is
now back. I also added a few of the missing descriptions
in the options command description in Reference.doc.
Keyboard command to reverse two characters
A new command has been added which switches the position of
the previous two characters. By default, this is mapped to
the ^t combination.
"run" function changed
The supplied run function previously referenced c:run
directly. Now it uses $(which run). This allows you to
have the run command anyplace in your path, or in the resi-
dent list.
EOF no longer crashes shell when +e option used
In SKsh 1.4, it was possible to crash the shell if command
line editing was disabled (+e option) and an end-of-file
was sent to the shell with "^\". This no longer happens.
Keyboard EOF will now terminate read loop
If a while loop is constructed using the read statement:
while read foo; do echo $foo; done
the loop can now be terminated with an EOF sent from the
keyboard. Previously the loop worked fine if its input was
redirected from a file, but not from the keyboard. This
only was a problem if the +e option was used.
File name mapping problem fixed
The "." character when used to represent the present work-
ing directory occasionally gave incorrect results when in
the root directory of a given device. For example, if
"cd"ed to ram:, the string ./foo would expand to ram:/foo,
which has an extra '/' character. This problem has been
fixed.
SKsh Amiga Shell Page 9 Addendum to 1.5
Empty lines no longer added to history list
Some combinations of history flags and variables would al-
low empty lines to be added to the history buffer. This no
longer happens.
CMDNUM variable only incremented for added history lines
The CMDNUM variable is only incremented if the typed line
is actually added to the history buffer. This keeps the
value of the variable in sync with the history list.
cat command now provided as external command
The cat command is now provided both as a builtin command
and as an external binary. The external form has several
advantages, including that it is much faster and can copy
binary data as well as ascii data. To use the external
command by default, unset the builtin form with "unset -b
cat".
num command added
The num external command can add line numbers to either its
standard input or named files. The number of digits used
is changeable; see the documentation on that command in the
ExtCmds.doc file for details.
cut command added
A cut command, similar to the Un*x command of the same
name, is now provided as an external binary. This cut is
actually a slight superset of the Un*x command, as it al-
lows columns to be re-ordered, something the Un*x command
will not do with most implementations. Both character and
field oriented operation is supported.
indent command added
An indent command is now provided as an external binary.
It simply indents input lines by a given amount.
SKsh Amiga Shell Page 10 Addendum to 1.5
encr command added
The encr command provides a function similar to the Un*x
crypt command, although with a vastly different algorithm.
It will encrypt from a file to a file, or it can act as a
filter to encrypt standard input to standard output. The
key can be of any length limited only by the maximum pass-
able command line. Unlike crypt, the encrypted files are
not guaranteed (and in fact in most cases will not be)
ASCII files. However, encr can encrypt binary data as well
as ASCII data. See the encr entry in the ExtCmds.doc file
for details. That entry also briefly discusses the secu-
rity of the encrypted files; I would like to hear if anyone
manages to break the encryption scheme. I have provided a
file of 819 bytes of encrypted english text with SKsh 1.5
for anyone who wishes to take up the challenge.
dwclist command added
A dwclist command has been added which allows wildcard ex-
pansion to be selectively disabled for individual commands.
The operation and options of this command are similar to
those of the complist command. Before performing wildcard
expansion on arguments, SKsh will search for the command
name in the dwclist. If found, wildcards will be passed on
unexpanded.
The dwclist can be listed or cleared, and arguments can be
added or deleted from the list. Use of long a long dwclist
will slightly degrade the SKsh interpreter performance, al-
though commands in the list will run much faster if passed
parameters with wildcards.
The dwclist is very useful for external programs which per-
form their own wildcard expansion. By putting the command
in the dwclist, SKsh will let that command perform its own
wildcard expansion, thus circumventing the 255 character
command line limit in AmigaDos 1.3. There are several
things to note about this command; for details see the en-
try in Reference.doc.
+w option added
A "w" option has been added to the set of SKsh options. If
set, then the dwclist will be used to determine commands
for which wildcards are not to be expanded. If unset
(which is the default), the dwclist will be ignored, re-
sulting in slightly faster performance.
SKsh Amiga Shell Page 11 Addendum to 1.5
Verifying the SKsh 1.5 Installation
SKsh 1.5 includes a script file called "Check_1.5.sksh". You
should set the script bit on this file if it is not set (using
"chmod +s Check_1.5.sksh"), and run the script. It will check
your SKsh installation for missing files, files with improper
checksums (perhaps indicating an old version of that file),
and files with improper permissions. It will check the main
SKsh binaries, the external commands, and will optionally
check the documentation files if you indicate that you wish to
do this. It will also check that the external binaries are in
your SKsh search path. You must run this script under version
1.5 after installing version 1.5. In other words, if you use
1.4 to install 1.5, you must quit version 1.4, execute version
1.5, and run the script.
A Word about Command Invocation under SKsh
SKsh does not actually invoke external commands itself. In-
stead, it builds a command line with all passed parameters and
passes this command line to ARP. However, there are differing
requirements for various types of AmigaDos programs (such as
BCPL versus Lattice C). Occasionally ARP will fail to invoke
a particular program correctly. It does quite a good job con-
sidering the situation, but sometimes it will fail. I unfor-
tunately cannot do anything about this in SKsh, so if there
are few programs you cannot invoke correctly, you will have to
invoke them from the AmigaDos shell.
Fortunately, however, AmigaDos 2.0 will provide a standard
method of program invocation. When I can compile SKsh to use
that feature, the problem will be eliminated. (That will,
however, mean that SKsh will run only under AmigaDos 2.0) Un-
til then, there is nothing I can do to help. Sorry!
Misc. Notes
Make sure that you re-install the .skshinit file. You can
make and use the pre-parsed form of this file if you wish.
The "Stuff.sksh" file has also changed with the addition of
the emacs_mode and vi_mode functions. All of the external bi-
naries have changed as well and must be re-installed.
There has been some confusion about the interaction of the 'h'
option and the history variables (such as MAXDIST and LLMIN).
If the 'h' option is set, every non-blank line will be added
to the history list, even if it does not meet the qualifica-
tions imposed by the history variables. This effectively
overrides any effect those variables might have. To effec-
tively use the variables, keep the 'h' flag reset.
SKsh Amiga Shell Page 12 Addendum to 1.5
A brief note about SKsh and the Amiga 3000: I have not person-
ally tested this, but various people have reported that 1)
SKsh works with 1 megabyte of chip memory running under either
AmigaDos 1.3 or AmigaDos 2.0, and 2) SKsh does not run with 2
megabytes of chip memory. At the moment I have no idea why it
would not run with 2 megabytes of chip memory, and I don't
have access to a 3000 to test it with, so the short term prog-
nosis for this problem is bleak. As far as I can tell, noth-
ing in the code should care the least bit about how much chip
memory is around. There does seem to be a problem, however,
One reported workaround (which I have also not tested) is to
run NofasTmem before invoking SKsh, and again after to re-
allocate the memory.
I removed the readme.pipes file, which described how to use
real pipes. I also removed the associated code. Until I get
it working for real, the code was just taking up space and not
doing anyone any good. Hopefully I will get this working in
the next release or two (perhaps it will become easier with
AmigaDos 2.0).
Again, thanks to all who have provided bug reports and ideas
for enhancements. I would like to make SKsh the best and most
complete command interpreter available for the Amiga, and this
feedback helps greatly. If you have suggestions for improve-
ments, please forward them to me. I cannot implement them all
for each release, however, so if I don't get to your "pet" en-
hancement in the very next release, please be patient. There
is a good chance it will get in eventually.
Finally...
My home address and phone number are likely to change sometime
in the next 6 to 8 months. I will try to include the new ad-
dress and phone number in release 1.6 of SKsh, provided that I
know what it is by then. If you try to reach me at the old
number or address and get no response, this is why!
SKsh 1.6: tentatively planned for 6 months from the release
date of 1.5.
SKsh Amiga Shell Page 13 Addendum to 1.5